﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FSO.Reports
{
    public partial class UserControlSelectSum : UserControl
    {
        private decimal _fromSum = 0;
        private decimal _toSum = 0;

        public UserControlSelectSum()
        {
            InitializeComponent();

            radMaskedEditBoxFromSum.Enabled = false;
            radMaskedEditBoxToSum.Enabled = false;
            radMaskedEditBoxFromSum.Mask = "N2";
            radMaskedEditBoxToSum.Mask = "N2";
        }

        public bool IsNull
        {
            get
            {
                bool bReturn = true;
                if (radCheckBoxSumIsNull.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                {
                    bReturn = false;
                }
                return bReturn;
            }
        }
        private void radCheckBoxSumIsNull_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
        {
            if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                radMaskedEditBoxFromSum.Enabled = true;
                radMaskedEditBoxToSum.Enabled = true;

                radMaskedEditBoxFromSum.Text = "0";
                radMaskedEditBoxToSum.Text = "0";
            }
            else
            {
                radMaskedEditBoxFromSum.Enabled = false;
                radMaskedEditBoxToSum.Enabled = false;
            }
        }

        public decimal FromSum
        {
            get 
            {
                _fromSum = System.Convert.ToDecimal(radMaskedEditBoxFromSum.Text);
                return _fromSum; 
            }
        }
        public decimal ToSum
        {
            get
            {
                _toSum = System.Convert.ToDecimal(radMaskedEditBoxToSum.Text);
                return _toSum;
            }
        }
    }
}
